<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <div id="div">
        <input type="text" v-model="a">
        <input type="text" v-model="b.c">
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    const app = new Vue({
        el: '#div',
        data: {
            a: 1,
            b: {
                c: 2
            }
        },

        // 在computed中定义方法，返回计算属性

        watch: {
            a(newValue, oldValue) {
                console.log(newValue, oldValue)
            },
            'b.c'(newValue, oldValue) {
                console.log(newValue, oldValue);

            }
        }
    })
</script>

</html>